
(import (turtle turtle3)
        (scheme base))

(define (cube t size)
  (repeat (4)
    (repeat (4)
      (forward! t size)
      (yaw! t 90))
    (pitch! t 90)
    (forward! t size)
    (pitch! t -90)
    (roll! t -90)))

(define (circle3d t radius)
  (define circum (* radius 6.283185307))
  (define start-orient (get-orient t))
  (define start-pos (get-pos t))
  (repeat (120)
    (forward! t (/ circum 120))
    (pitch! t -3))
  (apply set-orient! t start-orient)
  (set-pos! t start-pos))

(define (sphere t radius)
  (repeat (20)
    (circle3d t radius)
    (yaw! t 9)))

(define (helix t size)
  (repeat (80)
    (forward! t (/ size 7))
    (yaw! t 10)
    (pitch! t 20)))

(define (tetrahedron t size)
  (repeat (3)
    (repeat (3)
      (forward! t size)
      (yaw! t 120))
    (yaw! t 60)
    (roll! t 109.47122063449069)))

(define me (make-turtle))
(nutate! me)

;(cube me 100)
(sphere me 100)
;(helix me 100)
;(tetrahedron me 140)

